package ui {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.MouseEvent;

import ru.cjay.loading.ResourceManager;
import ru.cjay.loading.UnsafeConnection;

public class FriendIconMC extends MovieClip {
    private var window:MovieClip = null;
    public function FriendIconMC() {
        window =new (ResourceManager.getInstance().getSwfAssetClass("ui:FriendIcon") as Class)();
        window.btnAddFriend.addEventListener(MouseEvent.CLICK, addFriend);
        window.btnBuyFriend.addEventListener(MouseEvent.CLICK, buyFriend);
        window.label.visible = false;
    }
    private function addFriend(event:MouseEvent):void{
			// TODO: Realize this method
			trace("I Add Friend now");
		}
    private function buyFriend(event:MouseEvent):void{
			// TODO: Realize this method
			trace("I Buy Friend now");

		}
    public function setFriend(p_name:String, p_icon:String):void{
			window.btnAddFriend.visible = false;
			window.btnBuyFriend.visible = false;
			window.label.text = p_name;
			window.label.visible = true;
			var icon_loader:Sprite = UnsafeConnection.UnsafeLoader(p_icon,32,32);
			window.icon.addChild(icon_loader);

		}
}
}
